[ Intro ]   [ Lesson1 ]   [ Lesson2 ]   [ Lesson3 ]   [ Lesson4 ]   [ Lesson5 ]   [ Lesson6 ]   [ Lesson7 ]   [ Lesson8 ]

 


More about semicolons

 

As the engine can not determine where a line ends by itself (because the compiled script is one long row of code), it needs the user to point it out for it. In many cases it is obvious that the line ends when a completely different command follows on the next, but there are occasions where this can be misunderstood and to avoid all these possibilities altogether, the creators of the programming languages world around have agreed to force the users to mark the end of every line with a ";". However, not all lines need to be ended with it and there is no other choice than to learn them.

 

Occasion 1: All rows that start with #, as in #define or #include don't need to have the semicolon at the end.

 

Occasion 2: All functions, such as Create() or FirePrimary() should not use it either. Calls for these functions however, as call-script Create(); for example, need to be ended with a semicolon.

Occasion 3: No comparing statements, (that use to start with either if or while) end with semis.

Occasion 4: Neither of the two curly brackets { or } need to be ended with semis and if you like, you can actually place out the curlies wherever you like to save more space:

example

if (number == 3)

{

Sleep 100;

}


Can as well be converted to:

example

if (number == 3)     {     Sleep 100;     }

move onto

if () -functions

Congratulations, if you mastered this part, you can continue reading Lesson 1.


© Proud like a god (and a little Storm)